﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using IT_Tracker.ENTIDADES;
using System.Data.SqlClient;
using System.Data;

namespace IT_Tracker.DADOS
{
    public class BDOlosPE
    {

        #region Declarações
                
        //String de Conexão
        private string conString = @"Data Source=STO-DSK-CC001\SQLEXPRESS;Initial Catalog=OLOS_PE_BD;Integrated Security=True; User Id=prvuser; Password=prvuser;";
        
        //Data Adapter
        SqlDataAdapter da = new SqlDataAdapter();

        #endregion


        public DataTable GetTab(DateTime dataInicial, DateTime dataFinal)
        {
            //Lista de Tabulações
            List<ConfigDisp> lstConfigDisp = new List<ConfigDisp>();

            DataTable dt = new DataTable();
            
            SqlConnection con = new SqlConnection(conString);



            try
            {
                con.Open();                

                da.SelectCommand = new SqlCommand("spTabTotal");
                da.SelectCommand.CommandType = CommandType.StoredProcedure;
                da.SelectCommand.Connection = con;

                da.SelectCommand.CommandTimeout = 0; 
                
                da.SelectCommand.Parameters.AddWithValue("@DataInicial", dataInicial);
                da.SelectCommand.Parameters.AddWithValue("@DataFinal", dataFinal);
                

                dt.BeginLoadData();
                da.Fill(dt);
                dt.EndLoadData();

                return (dt);             

            }
            catch (Exception ex)
            {

                throw ex;
            }

            finally
            {
                con.Close();
            }
    
            
        }



    }
}
